<?php
/*
 * @Author: lokei
 * @Date: 2022-09-29 12:56:17
 * @LastEditors: lokei
 * @LastEditTime: 2022-10-01 00:54:39
 * @Description: 
 */
namespace App\Http\Controllers\Cms\Form;

use App\Common\Tools\ResultTool;
use App\Http\Controllers\Controller;
use App\Models\Cms\Form\FormRecordModel;
use Illuminate\Http\Request;

class RecordController extends Controller {
    public function list() {
        $items = FormRecordModel::get();
        $res = ResultTool::success();
        $res['data']['items'] = $items;
        $res['data']['total'] = count($items);
        return $res;
    }

    public function get(Request $request) {
        $record = FormRecordModel::where('id', '=', $request->input('id'))->first();
        $res = ResultTool::success();
        $res['data'] = $record;
        return $res;
    }

    public function delete(Request $request) {
        FormRecordModel::where('id', '=', $request->input('id'))->delete();
        return ResultTool::success();
    }
}